/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import BD.MySql;
import Clases.Responsable;
import java.util.List;

/**
 *
 * @author angelo
 */
public class DAOResponsable {

    public static boolean modificarResponsable(Responsable responsable) {
        return false;
    }

    public static boolean cargarResponsable(Responsable responsable) {
        String sql = "INSERT INTO Responsable(Nombre, Apodo, Email, PathFoto) VALUES "
                + "(\"" + responsable.getNombre() + "\",\"" + responsable.getApodo() + "\",\"" + responsable.getEmail() + "\",\""
                + responsable.getPathFoto()
                + "\")";
        MySql mySql = new MySql();
        if (mySql.executeUpdate(sql) == 0) {
            return false;
        } else {
            return true;
        }
    }

    public static boolean eliminarResponsable(Responsable responsable) {
        return false;
    }

    public static List<Responsable> getResponsable() {
        String sql = "SELECT * FROM Responsable";
        MySql<Responsable> mySql = new MySql<>();
        List<Responsable> lista = mySql.executeQuery(sql, Responsable.class);
        return lista;
    }

    public static boolean emailDisponible(String email) {
        String sql = "SELECT * FROM Responsable where Email =  \"" + email + "\"";
        MySql<Responsable> mySql = new MySql<>();
        List<Responsable> lista = mySql.executeQuery(sql, Responsable.class);

        if (lista.isEmpty()) {
            return true;
        } else {
            return false;
        }
    }

    public static Responsable getResponsable(String email) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
